package com.pb.wkflow.api.service;

import com.pb.infra.oth.entity.common.Result;
import com.pb.wkflow.api.controller.request.ProcessInstanceCreateRequest;
import com.pb.wkflow.api.controller.request.ProcessInstanceRequest;
import com.pb.wkflow.api.controller.request.ProcessTaskRequest;
import com.pb.wkflow.api.controller.response.ProcessResponse;
import com.pb.wkflow.api.entity.ApprovalProcessTrace;
import com.pb.wkflow.api.entity.NextParticipantEntity;
import com.pb.wkflow.api.entity.WfSysProcInfoEntity;

import java.util.List;

/**
 * @author 苗益辉
 * @date 2022/9/19 10:45
 */
public interface ProcInstService {

    /**
     * 开启流程
     * @param request request
     * @return ProcessResponse
     */
    ProcessResponse startProcess(ProcessInstanceCreateRequest request, boolean flag);

    /**
     * 开启并提交流程
     * @param request request
     * @return ProcessResponse
     */
    ProcessResponse startAndSubmitProcess(ProcessInstanceCreateRequest request);

    /**
     * 根据流程实例id终止流程
     * @param request request
     */
    void terminateProcess(ProcessInstanceRequest request);

    /**
     * 删除流程
     * @param request request
     */
    void deleteProcessInstance(ProcessInstanceRequest request);

    /**
     * 查询流程轨迹
     * @param request request
     * @return ProcessResponse
     */
    ProcessResponse queryProcessTrack(ProcessInstanceRequest request);

    /**
     * 查询流程轨迹
     * @param request request
     * @return List<ProcessTrackTaskEntity>
     */
    List<ApprovalProcessTrace> queryProcessTrackV2(ProcessInstanceRequest request);

    /**
     * 查看详情
     * @param request request
     * @return WfSysProcInfoEntity
     */
    WfSysProcInfoEntity getDetail(ProcessInstanceRequest request);

    /**
     * 查询流程进程列表
     * @param pageIndex 页码
     * @param pageSize 页数
     * @param request request
     * @return Result
     */
    Result queryInstance(Integer pageIndex, Integer pageSize,ProcessTaskRequest request);

    /**
     * 获取当前节点处理人
     * @param request request
     * @return Result
     */
    List<NextParticipantEntity> getParticipant(ProcessInstanceRequest request);
}
